import net.Synchronizer;
import net.SimpleSendingMessageFactory;
import net.receiving.IncomingMessageFactoryImpl;

import javax.swing.*;

import util.Config;
import model.Model;
import gui.MainFrame;

import java.util.Arrays;
import java.net.InetAddress;

public class Main {

    public static void main(String[] args) throws Exception {
        final Model model = new Model();
        final Synchronizer synchronizer = new Synchronizer(
                SimpleSendingMessageFactory.getInstance(), new IncomingMessageFactoryImpl(), model);
        SwingUtilities.invokeAndWait(new Runnable() {
            public void run() {
                Config config = Config.getInstance();
                MainFrame frame = new MainFrame(config.getFrameTitle(), model, config.getNames());
                frame.setSize(config.getFrameWidth(), config.getFrameHeight());
                frame.setVisible(true);
            }
        });
        synchronizer.start();
    }

}
